<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="content-type" content="text/html;charset=utf-8">
    <title>Title</title>
    <style>
        body, table, tr, th, td {
            font-family: "Microsoft YaHei UI";
            font-size: 12px;
        }
    </style>
</head>
<body>
<ul>
    <@role user='123456' role='admin';result1,result2>
    <#if result1>
        我的角色是<font color="red">admin</font>
    </#if>
    我拥有的权限是:<font color="red">
    <#list result2 as item>
        ${item},
    </#list>
</font>
</@role>
</ul>
<ul>
    <h2>字符串内建函数</h2>
    <#list "a|b|c|d"?split("|")as item>
        <li>${item}</li>

    </#list>
</ul>
<ul>
    <#assign var1="01/03/2017"?date("MM/dd/yyyy") />
    <#assign var2="15:30:43"?time("HH:mm:ss") />
    <#assign var3="2016-03-20 15:30:43"?datetime("yyyy-MM-dd HH:mm:ss") />
    <li>${var1}</li>
    <li>${var2}</li>
    <li>${var3}</li>
</ul>
<ul>
    <h2>数字类型内建函数 num=3.13457</h2>
    <#assign num=3.13457/>
    <li>${num?string("0.##")}</li>
    <li>${num?round}</li>
</ul>
<ul>
    <h2>list 内建函数</h2>
    <#assign listVar=[1,2,3,4,11,12,13,14,21,22,23,24]/>
    <li>4个一组分块：${listVar?chunk(4)?size}</li>
    <#list listVar?chunk(4)?last as item>
        <li>${item}</li>
    </#list>
</ul>
<ul>
    <h2>其他 内建函数</h2>
    <#assign sVar="hello"/>
    <li>${sVar?is_number?string("yes","no")}</li>
    <li>${sVar?has_content?string("yes","no")}</li>
    <li>${var!"111"}</li>
    <li>eval:${("1 + 2")?eval}</li>
    <li>eval是否是数字:${("1" + "2")?eval?is_number?string("yes","no")}</li>
</ul>
</body>
</html>